<template>
  <div class="home">
    <el-container>
      <el-header>
        <div class="header-content">
          <h1>Smart API Tester</h1>
          <el-menu mode="horizontal" :default-active="activeIndex" router>
            <el-menu-item index="/">首页</el-menu-item>
            <el-menu-item index="/projects">项目管理</el-menu-item>
            <el-menu-item index="/test-cases">测试用例</el-menu-item>
            <el-menu-item index="/case-generator">用例生成</el-menu-item>
            <el-menu-item index="/execution-monitor">执行监控</el-menu-item>
            <el-menu-item index="/data-driven">数据驱动</el-menu-item>
            <el-menu-item index="/reports">测试报告</el-menu-item>
          </el-menu>
        </div>
      </el-header>
      <el-main>
        <div class="welcome-section">
          <h2>欢迎使用 Smart API Tester</h2>
          <p>智能API测试工具，降低API测试门槛，提高测试效率</p>
          <div class="feature-cards">
            <el-card class="feature-card">
              <template #header>
                <div class="card-header">
                  <el-icon><document /></el-icon>
                  <span>OpenAPI解析</span>
                </div>
              </template>
              <p>自动解析OpenAPI规范，生成测试用例</p>
            </el-card>
            <el-card class="feature-card">
              <template #header>
                <div class="card-header">
                  <el-icon><data-analysis /></el-icon>
                  <span>数据驱动测试</span>
                </div>
              </template>
              <p>支持多种数据源，实现数据驱动测试</p>
            </el-card>
            <el-card class="feature-card">
              <template #header>
                <div class="card-header">
                  <el-icon><pie-chart /></el-icon>
                  <span>可视化报告</span>
                </div>
              </template>
              <p>生成直观的测试报告和统计分析</p>
            </el-card>
          </div>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import { ref } from 'vue'
import { Document, DataAnalysis, PieChart } from '@element-plus/icons-vue'

export default {
  name: 'Home',
  components: {
    Document,
    DataAnalysis,
    PieChart
  },
  setup() {
    const activeIndex = ref('/')

    return {
      activeIndex
    }
  }
}
</script>

<style scoped>
.home {
  height: 100vh;
}

.el-header {
  background-color: #409EFF;
  color: white;
  padding: 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header-content h1 {
  margin: 0;
  font-size: 24px;
}

.el-menu {
  background-color: transparent;
  border-bottom: none;
}

.el-menu-item {
  color: white;
  border-bottom: 2px solid transparent;
}

.el-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.el-menu-item.is-active {
  border-bottom-color: white;
}

.welcome-section {
  text-align: center;
  padding: 40px 20px;
}

.welcome-section h2 {
  font-size: 32px;
  margin-bottom: 16px;
  color: #303133;
}

.welcome-section p {
  font-size: 18px;
  color: #606266;
  margin-bottom: 40px;
}

.feature-cards {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.feature-card {
  width: 300px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
}
</style>